package com.tomcat.myapplication.adapter;

import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tomcat.myapplication.R;
import com.tomcat.myapplication.bean.AdapterData;

import java.util.List;

public class QueryAdapter extends BaseQuickAdapter<AdapterData, BaseViewHolder> {


    private int column = 2;
    public void setColumn(int column) {
        this.column = column;
    }

    public QueryAdapter(@Nullable List<AdapterData> data) {
        super(R.layout.item_query, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, AdapterData item) {
        helper.setText(R.id.name, item.getName())
                .setText(R.id.value1, item.getCheckSum() + "")
                .setText(R.id.value2, item.getStaffSum() + "")
        ;

        if (column == 2) {
            TextView tv2 = helper.getView(R.id.value2);
            tv2.setVisibility(View.GONE);
            helper.getView(R.id.line2).setVisibility(View.GONE);
        }
    }
}
